From: Florian Müllner Date: Thu, 20 Nov 2025 15:09:44 +0000 (+0100) Subject: swipeTracker: Immediately flip delta in RTL locales X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~92 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a02835aacadbc14dc4350add3bae99c70e38f1b0;p=gnome-shell.git swipeTracker: Immediately flip delta in RTL locales The delta is currently flipped in a shared code path, after appending the unmodified value to the event history. As a result, the calculated final velocity for touchpad gestures is wrong in RTL locales. Fix this by modifying the delta immediately when handling the events, so that all other code operates on the correct values. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8840 Part-of: --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 45b23bfae..7a0703c26 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -561,10 +561,6 @@ export const SwipeTracker = GObject.registerClass({ if (this._state !== State.SCROLLING) return; - if (this.orientation === Clutter.Orientation.HORIZONTAL && - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) - delta = -delta; - this._progress += delta / distance; this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress)); @@ -575,8 +571,8 @@ export const SwipeTracker = GObject.registerClass({ _updatePanGesture(panGesture) { const deltaVec = panGesture.get_delta_abs(); const delta = this.orientation === Clutter.Orientation.HORIZONTAL - ? -deltaVec.get_x() - : -deltaVec.get_y(); + ? this._getGestureDirFactor() * deltaVec.get_x() + : this._getGestureDirFactor() * deltaVec.get_y(); this._updateGesture(delta, this._distance); } @@ -587,6 +583,10 @@ export const SwipeTracker = GObject.registerClass({ return; } + if (this.orientation === Clutter.Orientation.HORIZONTAL && + Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + delta = -delta; + this._history.append(time, delta); this._updateGesture(delta, distance); }